import React from 'react';
import {sessionManager} from '../../utils/sessionStorage';
import Grid from '../../components/table/grid';
import {injectIntl} from 'react-intl';

class BillDetails4Month extends React.Component {
    constructor(props) {
        super(props);
        this.info=sessionManager.get('monthBill');
        this.columns = [
            {
                title: '账单日期',
                dataIndex: 'settlementDay',
                key: 'settlementDay',
            },
            {
                title: '结算电量（度）',
                dataIndex: 'electric',
                key: 'electric',
            },
            {
                title: '结算电费（元）',
                dataIndex: 'electricAmount',
                key: 'electricAmount',
            },
            {
                title: '结算服务费（元）',
                dataIndex: 'serviceAmount',
                key: 'serviceAmount',
            },
            {
                title: '结算总费用（元）',
                dataIndex: 'totalAmount',
                key: 'totalAmount',
            },
            {
                title: '操作',
                render: (text,record) => (
                    <a onClick={() => this.goLink(text, record)}>订单明细</a>
                )
            },
        ]
    }

    goLink=(text,record)=>{
        sessionManager.set('OrderDetails', text);
        this.props.history.push({pathname: '/finance/OrderDetails'});
    };

    componentDidMount() {

    }


    render() {
        return (
            <Grid columns={this.columns} params={{settlementDay:this.info.settlementDay}} url={'/api/settlement/settled/monthlyBillDaily'}/>
        )
    }
}

export default injectIntl(BillDetails4Month)
